<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .box1 {
            width: 200px;
            height: 200px;
            background-color: #bfa;
            /*float: left; // 浮动后会导致box2被box1覆盖*/
            overflow: hidden; // 开启BFC后，子元素的外边距将不会对父元素生效
        }
        .box2 {
            width: 200px;
            height: 200px;
            background-color: orange;
            overflow: hidden; // 开启了box2的BFC
        }
        .box3 {
            width: 100px;
            height: 100px;
            background-color: yellow;
            margin-top: 100px; // 子元素的外边距传递给父元素
        }
    </style>
</head>
<body>
    <div class="box1">
        <div class="box3"></div>
    </div>
    <div class="box2">

    </div>
</body>
</html>